import request from './request';

// 获取成果列表
export const achievementList = (query?: any) => {
  return request({
    method: 'get',
    url: '/kjy/achievement/list',
    params: query,
  });
};
// 发布成果
export const publishAchievement = (query: any) => request.post('/kjy/achievement', query);
// 获取成果详情
export const reqGetAchievementDetail = (id: string) => request.get('/kjy/achievement/' + id);
// 获取推荐成果
export const reqGetRecommendAchievement = (id: string) =>
  request.get(`/kjy/achievement/recommend?achievementId=${id}`);
// 删除成果
export function delAchievement(id: number) {
  return request({
    url: '/kjy/achievement/' + id,
    method: 'delete',
  });
}
// 编辑成果
export function updateAchievement(query: any) {
  return request({
    url: '/kjy/achievement',
    method: 'put',
    data: query,
  });
}

// 获取需求列表
export const needList = (query?: any) => {
  return request({
    url: '/kjy/demand/list',
    method: 'get',
    params: query,
  });
};
// 发布需求
export const publishNeed = (query: any) => request.post('/kjy/demand', query);
// 获取需求详情
export const reqGetDemandDetail = (id: string) => request.get('/kjy/demand/' + id);
// 获取推荐需求
export const reqGetDemandRecommend = (id: string) =>
  request.get(`/kjy/demand/recommend?demandId=${id}`);
// 删除需求
export function delDemand(id: number) {
  return request({
    url: '/kjy/demand/' + id,
    method: 'delete',
  });
}
// 编辑需求
export function updateDemand(query: any) {
  return request({
    url: '/kjy/demand',
    method: 'put',
    data: query,
  });
}
